<html>
<head>
<meta charset="UTF-8">
<title>服务器信息修改</title>
<link href="../../static/easyui/themes/bootstrap/easyui.css" rel="stylesheet" type="text/css"/>
<link href="../../static/easyui/themes/icon.css" rel="stylesheet" type="text/css"/>
<link href="../../static/css/esaas-easyui-edit.css" rel="stylesheet" type="text/css"/>
<script src="../../static/easyui/jquery.min.js" type="text/javascript"></script>
<script src="../../static/easyui/jquery.easyui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../static/easyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="../../static/plugin/assets/jslib.util.js" type="text/javascript"></script>
<script src="../../static/plugin/assets/jslib.jquery.ajax.js" type="text/javascript"></script>
<script src="../../static/plugin/assets/jslib.easyui.util.js" type="text/javascript"></script>
<script src="../../ffres/dict/all.js" type="text/javascript"></script>
<a href="" target="_blank" id="commonLink" name="commonLink"></a>
</head>
<body class="easyui-layout" scroll="no">
	<form id="ff" method="post">
		<div class="esaas-info-title">服务器信息</div>
		<table class="esaas-info-edit-table">
			<tr>
				<td width="15%" align="right">ecs标识：</td>
				<td width="35%"><input class="easyui-textbox" type="text" readOnly
					name="ecsId" data-options="required:true"
					style="width: 100%; height: 25px;"></input></td>
				<td width="15%" align="right">服务器IP：</td>
				<td width="35%"><input class="easyui-textbox" type="text" 
					name="ecsIp" data-options="required:false"
					style="width: 100%; height: 25px;"></input></td>
			</tr>
			<tr>
				<td width="15%" align="right">服务器名称：</td>
				<td width="35%"><input class="easyui-textbox" type="text" 
					name="ecsName" data-options="required:false"
					style="width: 100%; height: 25px;"></input></td>
				<td width="15%" align="right">描述：</td>
				<td width="35%"><input class="easyui-textbox" type="text" 
					name="ecsDesc" data-options="required:false"
					style="width: 100%; height: 25px;"></input></td>
			</tr>
			<tr>
				<td width="15%" align="right">所在位置：</td>
				<td width="35%"><select class="easyui-combobox"
					id="ecsRegion" name="ecsRegion"
					style="width: 100%; height: 25px;" 
					data-options="required:false,editable:false,valueField:'enname',textField:'cnname',data:ECS_REGION">
				</select></td>
				<td width="15%" align="right">操作系统：</td>
				<td width="35%"><select class="easyui-combobox"
					id="ecsOs" name="ecsOs"
					style="width: 100%; height: 25px;" 
					data-options="required:false,editable:false,valueField:'enname',textField:'cnname',data:ECS_OS">
				</select></td>
			</tr>
			<tr>
				<td width="15%" align="right">CPU(核)：</td>
				<td width="35%"><input class="easyui-textbox" type="text" 
					name="ecsVcpu" data-options="required:false"
					style="width: 100%; height: 25px;"></input></td>
				<td width="15%" align="right">内存(G)：</td>
				<td width="35%"><input class="easyui-textbox" type="text" 
					name="ecsMemory" data-options="required:false"
					style="width: 100%; height: 25px;"></input></td>
			</tr>
			<tr>
				<td width="15%" align="right">服务器磁盘(G)：</td>
				<td width="35%"><input class="easyui-textbox" type="text" 
					name="ecsDisk" data-options="required:false"
					style="width: 100%; height: 25px;"></input></td>
				<td width="15%" align="right">服务器用途：</td>
				<td width="35%"><select class="easyui-combobox"
					id="ecsPurpose" name="ecsPurpose"
					style="width: 100%; height: 25px;" 
					data-options="required:false,editable:false,valueField:'enname',textField:'cnname',data:ECS_PURPOSE">
				</select></td>
			</tr>
			<tr>
				<td width="15%" align="right">服务器登录方式：</td>
				<td width="35%"><select class="easyui-combobox"
					id="ecsLoginMethod" name="ecsLoginMethod"
					style="width: 100%; height: 25px;" 
					data-options="required:false,editable:false,valueField:'enname',textField:'cnname',data:ECS_LOGIN_METHOD">
				</select></td>
				<td width="15%" align="right">服务器登录用户：</td>
				<td width="35%"><input class="easyui-textbox" type="text" 
					name="ecsLoginUser" data-options="required:false"
					style="width: 100%; height: 25px;"></input></td>
			</tr>
			<tr>
				<td width="15%" align="right">服务器登录密码：</td>
				<td width="35%"><input class="easyui-textbox" type="password" 
					name="ecsLoginPwd" data-options="required:false"
					style="width: 100%; height: 25px;"></input></td>
				<td width="15%" align="right">状态：</td>
				<td width="35%"><select class="easyui-combobox"
					id="ecsState" name="ecsState"
					style="width: 100%; height: 25px;" 
					data-options="required:false,editable:false,valueField:'enname',textField:'cnname',data:ECS_STATE">
				</select></td>
			</tr>
			<tr>
				<td width="15%" align="right">服务器响应信息：</td>
				<td width="35%"><input class="easyui-textbox" type="text" 
					name="ecsMsg" data-options="required:false"
					style="width: 100%; height: 25px;"></input></td>
			</tr>
		</table>
	</form>
	<div style="text-align: center; padding: 15px">
		<a href="javascript:void(0)" class="easyui-linkbutton"
			onclick="submitForm()">&nbsp;保&nbsp;存&nbsp;</a> <a
			href="javascript:void(0)" class="easyui-linkbutton"
			onclick="closeForm()">&nbsp;关&nbsp;闭&nbsp;</a>
	</div>
	<script>		
		$(function() {
			var ecsId = $.getUrlParam('ecsId');
			$.restfulGet('../../api/ecs/base/info/' + ecsId,null,function(data){
					$('#ff').form('load', {
						ecsId : data.rows.ecsId,
						ecsIp : data.rows.ecsIp,
						ecsName : data.rows.ecsName,
						ecsDesc : data.rows.ecsDesc,
						ecsRegion : data.rows.ecsRegion,
						ecsOs : data.rows.ecsOs,
						ecsVcpu : data.rows.ecsVcpu,
						ecsMemory : data.rows.ecsMemory,
						ecsDisk : data.rows.ecsDisk,
						ecsPurpose : data.rows.ecsPurpose,
						ecsLoginMethod : data.rows.ecsLoginMethod,
						ecsLoginUser : data.rows.ecsLoginUser,
						ecsLoginPwd : data.rows.ecsLoginPwd,
						ecsState : data.rows.ecsState,
						ecsMsg : data.rows.ecsMsg
					});					
			});
		});
	
		function submitForm() {
			if (!$('#ff').form('validate'))
				return;
			var jsonData = $("#ff").serializeJson();
			$.restfulPut('../../api/ecs/base/info', jsonData, function(data) {
				window.parent.reloadList();
			});
		};
		
		function closeForm(){
			window.parent.JLEUtil.closewin();
		}
	</script>
</body>
</html>
